import 'package:cbec_app/entity/home/content/content_data.dart';
import 'package:cbec_app/generated/json/base/json_field.dart';
import 'package:cbec_app/generated/json/notice_entity.g.dart';
import 'dart:convert';
export 'package:cbec_app/generated/json/notice_entity.g.dart';

@JsonSerializable()
class NoticeEntity extends ContentData {
  @JSONField(name: "bg_color")
  String? bgColor = '';
  @JSONField(name: "page_margin")
  int? pageMargin = 0;
  String? color = '';
  @JSONField(name: "card_bg_color")
  String? cardBgColor = '';
  @JSONField(name: "card_vertical_padding")
  int? cardVerticalPadding = 0;
  @JSONField(name: "card_border_radius")
  int? cardBorderRadius = 0;
  String? uuid = '';
  String? content = '';

  NoticeEntity() {
    type = 'notice'; // 直接在构造函数中赋值
  }

  factory NoticeEntity.fromJson(Map<String, dynamic> json) => $NoticeEntityFromJson(json);

  @override
  Map<String, dynamic> toJson() => $NoticeEntityToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }

  @override
  ContentData fromJson(Map<String, dynamic> json) {
    return NoticeEntity.fromJson(json);
  }
}
